import json

lst = [
    {"name": "张三", "age": 19, "score": 99},
    {"name": "李四", "age": 20, "score": 92},
    {"name": "王五", "age": 21, "score": 93},
]

s = json.dumps(lst, ensure_ascii=False, indent=4)
print(type(s), s)

lst2 = json.loads(s)
print(type(lst2), lst2)

with open('student.txt', 'w', encoding='utf-8') as file:
    json.dump(lst, file, ensure_ascii=False, indent=4)
